﻿#pragma once

#ifndef ARD_ARM64DECODER
#define ARD_ARM64DECODER

#include <cstdint>
#include <arch/Opcode.h>
#include <arch/Function.h>
#include "arch/GeneralReg.h"
#include "arch/SystemReg.h"
#include "arch/Pstate.h"

class ARM64Decoder :public CmdDecoder
{
public:
	ARM64Decoder();
	int decoder(uint32_t code) override;
	uint64_t getPC() override;
	inline void pcNext() override {
		_pc += 4;
	}
	inline void setPc(uint64_t pc) override {
		_pc = pc;
	}
	inline void offsetPc(int64_t pc) override {
		_pc += pc;
	}
	std::shared_ptr<GeneralRegisiter> getGeneralRegisiter();
	std::shared_ptr<SystemRegisiter> getSystemRegisiter();
	std::shared_ptr<PSTATE> getPSTATE();
private:
	///三大类寄存器
	std::shared_ptr<GeneralRegisiter> generalReg = nullptr;
	std::shared_ptr<SystemRegisiter> sysReg = nullptr;
	std::shared_ptr<PSTATE> pstate = nullptr;

	///指令分组
};


#endif // !ARD_ARM64DECODER



